<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>contour2di</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab Function</center>
    <div align="right">Last update : sept 2000</div>
    <p>
      <b>contour2di</b> -  compute level curves of a surface on a 2D plot</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>[xc,yc]=contour2di(x,y,z,nz)  </tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>x,y</b>
        </tt>: two real row vectors of size n1 and n2: the grid.</li>
      <li>
        <tt>
          <b>z</b>
        </tt>: real matrix of size (n1,n2), the values of the function.</li>
      <li>
        <tt>
          <b>nz</b>
        </tt>: the level values or the number of levels.<ul>
          <li>
            <tt>
              <b>-  </b>
            </tt>If <tt>
              <b>nz</b>
            </tt> is an integer, its value gives the number of
  level curves  equally spaced from zmin to zmax as follows:<pre>

 z= zmin + (1:nz)*(zmax-zmin)/(nz+1)
   
                </pre>
            <p>
    Note that the <tt>
                <b>zmin</b>
              </tt> and <tt>
                <b>zmax</b>
              </tt> levels are not drawn  (generically they are reduced to points) but they can be added  with 
  </p>
            <pre>

 [im,jm] = find(z == zmin);     // or zmax 
 plot2d(x(im)',y(jm)',-9,"000")
   
                </pre>
            <p>
     - If <tt>
                <b>nz</b>
              </tt> is a vector, <tt>
                <b>nz(i)</b>
              </tt> gives the value of the ith level curve.
  </p>
          </li>
        </ul>
      </li>
      <li>
        <tt>
          <b>xc,yc</b>
        </tt>: vectors of identical sizes containing the contours definitions. See below for details.</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
      <tt>
        <b>contour2di</b>
      </tt> computes level curves of a surface <tt>
        <b>z=f(x,y)</b>
      </tt> on
    a 2D plot.  The values of <tt>
        <b>f(x,y)</b>
      </tt> are given by the matrix <tt>
        <b>z</b>
      </tt>
    at the grid points defined by <tt>
        <b>x</b>
      </tt> and <tt>
        <b>y</b>
      </tt>.</p>
    <p>
      <tt>
        <b>xc(1)</b>
      </tt> contains the level associated with first contour path,
    <tt>
        <b>yc(1)</b>
      </tt> contains the number <tt>
        <b>N1</b>
      </tt> of points defining this contour path
    and (<tt>
        <b>xc(1+(1:N1))</b>
      </tt>, <tt>
        <b>yc(1+(1:N1))</b>
      </tt> ) contain the coordinates
    of the paths points.
    The second path begin at <tt>
        <b>xc(2+N1)</b>
      </tt> and <tt>
        <b>yc(2+N1)</b>
      </tt> and so on.</p>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

[xc,yc]=contour2di(1:10,1:10,rand(10,10),5);
k=1;n=yc(k);c=1;
while k+yc(k)&lt;size(xc,'*')
  n=yc(k);
  plot2d(xc(k+(1:n)),yc(k+(1:n)),c)
  c=c+1;
  k=k+n+1;
end

 
  </pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="contour.htm">
        <tt>
          <b>contour</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="fcontour.htm">
        <tt>
          <b>fcontour</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="fcontour2d.htm">
        <tt>
          <b>fcontour2d</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="contour2d.htm">
        <tt>
          <b>contour2d</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="plot2d.htm">
        <tt>
          <b>plot2d</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="xset.htm">
        <tt>
          <b>xset</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
    <h3>
      <font color="blue">Author</font>
    </h3>
    <p>J.Ph.C.  </p>
  </body>
</html>
